package org.springframework.test.zhaohui;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.zhaohui.circle.Circle1;
import org.springframework.test.zhaohui.circle.Circle2;
import org.springframework.test.zhaohui.service.HelloService;

/**
 * LoadBeanDemo
 *
 * @author zhaohui
 */
public class LoadBeanDemo {

	public static void main(String[] args) {
		ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");

		// load bean by name
		HelloService helloService = ac.getBean(HelloService.class);
		helloService.sayHello("zhangsan");
		// 循环依赖
		Circle1 circle1 = ac.getBean(Circle1.class);
		circle1.test("lisi");
	}

}
